var Ajax;
if (Ajax && (Ajax != null)) {
    Ajax.Responders.register({
        onCreate: function() {
            if ($('spinner') && Ajax.activeRequestCount > 0)
                Effect.Appear('spinner', {duration:0.5,queue:'end'});
        },
        onComplete: function() {
            if ($('spinner') && Ajax.activeRequestCount == 0)
                Effect.Fade('spinner', {duration:0.5,queue:'end'});
        }
    });
}


function showHideInsertDiv(element){
     var elementId = '#'+element;
      $(elementId).slideToggle();
}

function showHideEditDiv(id,entytyName) {

               var elementId = '#div_edit_' + id;
              
               if ($(elementId).is(':visible')) {

                 $(elementId).slideUp();
               }
               else {
                  $(elementId).slideDown();
               }

            }

function closeifNoError(element , reloadElement,reloadurl){

    var elementId = '#'+element;
    if( $(elementId).find('.error').size() == 0){
               $(elementId).slideUp(1400 , function(){

                    $('#'+reloadElement).load(reloadurl);

               });



    }

}


function closeInsertifNoError(element){

      var elementId = '#'+element;
    if( $(elementId).find('.error').size() == 0){
               $(elementId).slideUp(1400, function(){
                   $('#listContainer').load('/demoracer/pilot/list');
               });

    }


}

